﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jayden.Dll.Core
{
	public class Description : IComparable<Description>
	{
		private string m_Id;

		public Description(string id)
		{
			if (id == null)
				throw new NullReferenceException("id cannot be null.");
			m_Id = id;
		}

		public string Id { get { return m_Id; } }
		public int CompareTo(Description other) { return Id.CompareTo(other); }
		public override int GetHashCode() { return Id.GetHashCode(); }
		public override bool Equals(object obj)
		{
			if (object.ReferenceEquals(this, obj))
				return true;
			if (obj is Description)
				return Id.Equals((obj as Description).Id);
			return false;
		}

		public override string ToString() { return m_Id; }

	}

	public class DescriptionDictionary : Dictionary<string, Description>
	{
		public void Add(Description description) { Add(description.Id, description); }
	}
}
